package com.hades.example.java.refactoring.after.c10.c10_14_replace_error_code_with_exception.v1;

public class Example {
    public static void main(String[] args) {
        Account account = new Account();
//        int result = account.withdraw(10);
//        if (result == -1) {
//            handleOverdrawn();
//        } else {
//            doTheUsualThing();
//        }
//        try {
//            account.newWithdraw(10);
//            doTheUsualThing();
//        } catch (BalanceException ex) {
//            handleOverdrawn();
//        }
        try {
            account.withdraw(10);
            doTheUsualThing();
        } catch (IllegalArgumentException ex) {
            handleOverdrawn();
        }
    }

    private static void handleOverdrawn() {

    }

    private static void doTheUsualThing() {
    }
}
